10 REM LINE SOURCE ANTENNA PATTERNS
20 REM "ANTENNA DESIGN USING PERSONAL COMPUTERS"
30 DIM FLDA(360)
40 PI=3.141593
50 KEY OFF
60 DEF FNLOG10(X)=.4343*LOG(X)
70 SCREEN 0,1
80 CLS
90 COLOR 1,0
100 PRINT "RADIATION INTEGRAL AND PATTERNS FOR A TRAVELING WAVE LINE SOURCE"
110 COLOR 4,0
120 PRINT
130 INPUT "WHAT IS THE LINE SOURCE LENGTH(WAVELENGTHS)";L
140 INPUT "WHAT IS THE NORMALIZED PHASE CONSTANT";B0
150 INPUT "DO YOU WANT TO INCLUDE A SIN(THETA) ELEMENT FACTOR(Y,N)";EP$
160 PRINT "SELECT THE DESIRED CURRENT DISTRIBUTION AMPLITUDE:"
170 PRINT "           1-UNIFORM"
180 PRINT "           2-TRIANGULAR"
190 PRINT "           3-COSINE"
200 PRINT "           4-COSINE SQUARED"
210 PRINT "           5-COSINE ON A PEDESTAL"
220 PRINT "           6-EXIT"
230 INPUT ID
240 IF ID<1 OR ID>6 THEN GOTO 160
250 IF ID=6 THEN GOTO 1110
260 C=.5
270 IF ID=5 THEN INPUT "WHAT IS THE RELATIVE HEIGHT OF THE PEDESTAL(0 TO 1)";C
280 IF C<0 OR C>1 THEN GOTO 270
290 ROD=PI/180
300 COLOR 14,0
310 REM COMPUTE PATTERN
320 FOR I=0 TO 180
330 TH=I*ROD
340 FLDA(I)=1
350 CTH=COS(TH)
360 U=PI*L*(CTH+B0)
370 IF ID>1 THEN GOTO 410
380 REM UNIFORM
390 IF ABS(U)>.01 THEN FLDA(I)=SIN(U)/U
400 GOTO 660
410 IF ID>2 THEN GOTO 450
420 REM TRIANGULAR
430 IF ABS(U)>.01 THEN FLDA(I)=(SIN(U/2)/(U/2))^2
440 GOTO 660
450 IF ID>3 THEN GOTO 510
460 REM COSINE
470 FLDA(I)=.7854
480 DEN=1-(2*U/PI)^2
490 IF ABS(DEN)>.01 THEN FLDA(I)=COS(U)/DEN
500 GOTO 660
510 IF ID>4 THEN GOTO 580
520 REM COSINE SQUARED
530 IF ABS(U)<.01 THEN GOTO 660
540 FLDA(I)=.5
550 DEN=U*(1-U*U/(PI^2))
560 IF ABS(DEN)>.01 THEN FLDA(I)=SIN(U)/DEN
570 GOTO 660
580 IF ID>5 THEN GOTO 1110
590 REM COSINE ON A PEDESTAL
600 T1=1
610 IF ABS(U)>.01 THEN T1=SIN(U)/U
620 T2=.7854
630 DEN=1-(2*U/PI)^2
640 IF ABS(DEN)>.01 THEN T2=COS(U)/DEN
650 FLDA(I)=(C*T1+(1-C)*T2*2/PI)/(C+(1-C)*2/PI)
660 FLDA(I)=ABS(FLDA(I))
670 IF EP$<>"N" THEN FLDA(I)=FLDA(I)*SIN(TH)
680 NEXT I
690 PRINT
700 REM COMPUTE BEAM POINTING ANGLE
710 FM=0
720 FOR I=0 TO 180
730 IF FLDA(I)=>FM THEN IMAX=I
740 IF FLDA(I)>FM THEN FM=FLDA(I)
750 NEXT I
760 FOR I=0 TO 180
770 FLDA(I)=FLDA(I)/FM
780 IF FLDA(I)<.0316 THEN FLDA(I)=.0316
790 FLDA(I)=20*FNLOG10(FLDA(I))
800 FLDA(360-I)=FLDA(I)
810 NEXT I
820 REM COMPUTE BEAMWIDTH
830 I=IMAX-1
840 I=I+1
850 IF FLDA(I)>-3 THEN GOTO 840
860 TH0=(-3-FLDA(I-1)+(I-1)*(FLDA(I)-FLDA(I-1)))/(FLDA(I)-FLDA(I-1))
870 BW=(TH0-IMAX)*2
880 SCREEN 2,0
890 VIEW (262,20)-(638,188)
900 WINDOW (-1,-1)-(1,1)
910 PRINT USING "BEAM MAX. AT ### degrees";IMAX
920 PRINT USING "BEAMWIDTH=###.# degrees";BW
930 REM PLOT GRID
940 CIRCLE (0,0),1,,,,.45
950 CIRCLE (0,0),.666,,,,.45
960 CIRCLE (0,0),.333,,,,.45
970 FOR THD=0 TO 150 STEP 30
980 TH=THD*ROD
990 LINE (COS(TH),SIN(TH))-(-COS(TH),-SIN(TH))
1000 NEXT THD
1010 PSET (0,FLDA(0)/30+1)
1020 FOR TH=0 TO 360
1030 THR=TH*ROD
1040 RAD=FLDA(TH)/30+1
1050 LINE -(RAD*SIN(THR),RAD*COS(THR))
1060 NEXT TH
1070 PRINT "10dB/DIV."
1080 PRINT
1090 INPUT "CONTINUE(Y,N)";K$
1100 IF K$<>"N" THEN GOTO 70
1110 SCREEN 0,1
1120 COLOR 7,0
1130 KEY ON
1140 END
